﻿using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;

namespace shop.Model
{
    [Index("ix_RefundDoc_RefundNo", nameof(RefundDoc.RefundNo))]
    public class RefundDoc
    {

        [Column(IsPrimary = true, IsIdentity =true)]
        public int Id {  get; set; }



        [Column(StringLength = 50)]
        public string PlatForm {  get; set; }

        [Column(StringLength = 50)]
        public string Shop {  get; set; }

        [Column(StringLength = 50)]
        public string RefundNo { get; set; }

        [Column(StringLength = 50)]
        public string ShouhouNo { get; set; }



        [Column(StringLength = 50)]
        public string Tid { get; set; }


        [Column(StringLength = 50)]
        public string RefundType { get; set; }


        [Column(StringLength = 150)]
        public string Stock { get; set; }


        /// <summary> 平台状态 </summary>
        [Column(StringLength = 50)]
        public string RefundStatus { get; set; }

        /// <summary> 系统状态 </summary>
        [Column(StringLength = 50)]
        public string ProcessStatus { get; set; }


        /// <summary> 递交失败原因 </summary>
        [Column(StringLength = 50)]
        public string GiveFailReason { get; set; }


        /// <summary> 退款回传状态 </summary>
        [Column(StringLength = 50)]
        public string BackStatus { get; set; }


        /// <summary> 退款阶段 </summary>
        [Column(StringLength = 50)]
        public string RefundStage {  get; set; }

        /// <summary> 客服介入 </summary>
        [Column(StringLength = 50)]
        public string cs_status { get; set; }


        /// <summary> 交易类型 </summary>
        [Column(StringLength = 50)]
        public string guarantee_mode { get; set; }


        /// <summary> 买家支付账号 </summary>
        [Column(StringLength = 50)]
        public string buyer { get; set; }


        /// <summary> 昵称 </summary>
        [Column(StringLength = 50)]
        public string buyerNick { get; set; }


        /// <summary> 申请退款金额 </summary>
        [Column(Precision =18, Scale =4)]
        public decimal RefundAmount { get; set; }



        /// <summary> 实际退款 </summary>
        [Column(Precision =18, Scale =4)]
        public decimal ActualRefundAmount { get; set; }


        /// <summary> 发货金额 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal TradeAmount { get; set; }



        [Column(StringLength = 500)]
        public string RefundReason { get; set; }


        [Column(StringLength = 500)]
        public string Remarks { get; set; }


        [Column(StringLength = 50)]
        public string logistics_name { set; get; }



        [Column(StringLength = 50)]
        public string logistics_no { set; get; }


        public DateTime? RefundTime {  get; set; }


        public DateTime? ModifyTime { get; set; }

        public DateTime? CreatedTime {  get; set; }

        /// <summary> 退款成功时间 </summary>
        public DateTime? current_phase_timeout { get; set; }


        /// <summary> 原始单省市区 </summary>
        [Column(StringLength = 100)] 
        public string OrigalCity { get; set; }


        [Column(StringLength = 300)] 
        public string OrigalAddr { get; set; }

        
        [Column(StringLength = 50)] 
        public string Operator { get; set; }


        /// <summary> 拒收退款标记 </summary>
        [Column(StringLength = 20)] 
        public string RefuseAccept { get; set; }



        [Column(StringLength = 50)] 
        public string trade_no { get; set; }

        [Column(StringLength = 50)]
        public string src_tids { get; set; }


        [Column(StringLength = 50)]
        public string Batch { get; set; }



        [Column(StringLength = 200)]
        public string PicFile { get; set; }

        /// <summary>  </summary>
        [Column(Precision =18, Scale =4)]
        public decimal RefundQty { get; set; }

        public int RowIndex { get; set; }

        public DateTime FTime { get; set; }

        public bool isdel { get; set; }



        /// <summary> 是否已经发送消息 </summary>
        public bool IsSendMessage { set; get; }


        [Column(StringLength =20)]
        public string DocFlag { get; set; }


        public List<RefundDocItem> Items { get; set; }


        public RefundDoc Clone()
        {
            return this.MemberwiseClone() as RefundDoc;   
        }
    }



    public class RefundDocItem
    {

        [Column(IsPrimary =true, IsIdentity =true)]
        public int id {  get; set; }


        public int DocId { get; set; }



        [Column(StringLength = 50)]
        public string RefundNo { get; set; }


        [Column(StringLength = 50)]
        public string Batch { get; set; }


        [Column(StringLength = 50)]
        public string platform { get; set; }


        [Column(StringLength = 100)]
        public string src_oid { get; set; }



        /// <summary> 平台状态 </summary>
        [Column(StringLength = 50)]
        public string RefundStatus { get; set; }


        [Column(StringLength = 50)]
        public string RefundType { get; set; }

        /// <summary> 平台货品ID </summary>
        [Column(StringLength = 50)]
        public string platform_goods_id { set; get; }

        /// <summary> 规格id </summary>
        [Column(StringLength = 50)]
        public string platform_spec_id { set; get; }



        /// <summary> 货品编号 </summary>
        [Column(StringLength = 50)]
        public string goods_no { set; get; }



        /// <summary> 规格码 </summary>
        [Column(StringLength = 50)]
        public string spec_no { set; get; }


        /// <summary> 货品名称 </summary>
        [Column(StringLength = 200)]
        public string goodsName { set; get; }


        /// <summary> 规格名称 </summary>
        [Column(StringLength = 200)]
        public string specName { set; get; }


        /// <summary> 数量 </summary>
        [Column(Precision =18, Scale =4)]
        public decimal num {  get; set; }


        /// <summary> 已结算数量 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal SettleNum { get; set; }


        /// <summary> 价格 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal price { get; set; }

        /// <summary> 货品退货数量 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal RefundQty { get; set; }


        /// <summary> 总额 </summary>
        [Column(Precision = 18, Scale = 4)]
        public decimal total_amount { get; set; }



        /// <summary> 规格名称 </summary>
        [Column(StringLength = 200)]
        public string remarks { set; get; }


        /// <summary> 规格名称 </summary>
        [Column(StringLength = 200)]
        public string GoodsReason { set; get; }


        public DateTime? modified { get; set; }

        public DateTime? created { get; set; }


        public DateTime FTime { get; set; }


    }

}
